package com.bishe.bishe.Service.ServiceImpl;

import com.bishe.bishe.Service.UnitService;
import com.bishe.bishe.dao.mapper.UnitMapper;
import com.bishe.bishe.pojo.Unit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class UnitServiceImpl implements UnitService {
    @Autowired
    private UnitMapper unitMapper;
    @Override
    public List<Unit> findall() {
        Example example=new Example(Unit.class);
        example.setOrderByClause("unit_number ASC");
        return unitMapper.selectByExample(example);
    }

    @Override
    public int insert(Unit unit) {
        return unitMapper.insert(unit);
    }

    @Override
    public int delete(Unit unit) {
        return unitMapper.delete(unit);
    }

}
